# encoding: utf-8
class Users::RegistrationsController < Devise::RegistrationsController
  prepend_before_filter :require_no_authentication, :only =>:create
  skip_before_filter :verify_authenticity_token
  #default create method
  def create
    super
  end

  def active_users
    active_token = params["activation_code"]
    return render_404 unless $humble_config['send_activation_mail']

    begin
      user = User.find_and_activate!(params[:activation_code])
      redirect_to new_user_session_path, :notice => t(:user_activated_login_now)
    rescue ArgumentError, User::ActivationCodeNotFound
      redirect_to new_user_registration_path, :alert => t(:couldnt_find_user_with_code_create_new_one)
    rescue User::AlreadyActivated
      redirect_to new_user_session_path, :alert => t(:user_already_activated_please_login)
    end
  end
  
  def active_page
    
  end
  
  def send_active_email
    _email = params[:email]
    u = User.where(:email => _email).first
    @status = 500
    if u 
      @status = 200
      u.send_admin_mail
    end
    
  end

  def after_sign_up_path_for(resource)
    # dashboard_console_path
    sign_out(resource)
    new_user_session_path
  end
end
